From: Alessandro Bono Date: Mon, 19 Aug 2024 09:47:45 +0000 (+0200) Subject: loginDialog: Catch possible errors when session is opened X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~219^2^2~39 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=f1223c6852ad5fcf279d5541dbb061e2a5613383;p=gnome-shell.git loginDialog: Catch possible errors when session is opened Since commit df84854d9073c457d79d7c2e6a5750428c52ff01 the function _onSessionOpened() is now async. This means that if an error occurs we get the following warning: ``` gnome-shell[1014]: Unhandled promise rejection. To suppress this warning, add an error handler to your promise chain with .catch() or a try-catch block around your await expression. Stack trace of the failed promise: _onSessionOpened@resource:///org/gnome/shell/gdm/loginDialog.js:1166:27 @resource:///org/gnome/shell/ui/init.js:21:20 ``` Follow the suggestion and add a try-catch block in order to reveal what the error is. In the catch phase, reset the faded AuthPrompt otherwise we can't retry with another user. Part-of: --- diff --git a/js/gdm/loginDialog.js b/js/gdm/loginDialog.js index e1153727d..db83f4621 100644 --- a/js/gdm/loginDialog.js +++ b/js/gdm/loginDialog.js @@ -1163,15 +1163,20 @@ export const LoginDialog = GObject.registerClass({ } async _onSessionOpened(client, serviceName, sessionId) { - if (sessionId) { - const conflictingSession = await this._findConflictingSession(sessionId); - if (conflictingSession) { - this._showConflictingSessionDialog(serviceName, conflictingSession); - return; + try { + if (sessionId) { + const conflictingSession = await this._findConflictingSession(sessionId); + if (conflictingSession) { + this._showConflictingSessionDialog(serviceName, conflictingSession); + return; + } } - } - this._authPrompt.finish(() => this._startSession(serviceName)); + this._authPrompt.finish(() => this._startSession(serviceName)); + } catch (error) { + logError(error, `Failed to start session '${sessionId}'`); + this._authPrompt.reset(); + } } _waitForItemForUser(userName) {